import { ExtractPropTypes, PropType } from "vue";
import { createPropsResolver } from "../../../dynamic-resolver";
import { schemaMapper } from '../schema/score-schema-mapper';
import scoreSchema from '../schema/score.schema.json';

export type SplitterPanePosition = 'left' | 'center' | 'right' | 'top' | 'bottom';

export const scoreProps = {
    size: {
        type: String,
        default: 'default',
        validator(value:string, props:any) {
            ['large', 'default', 'small'].includes(value)
        }
    },
    max: {
        type: Number,
        default: 5
    },
    disabled: Boolean,
    lowThreshold: {
        type: Number,
        default: 2
    },
    highThreshold: {
        type: Number,
        default: 4
    },
    colors: {
        type: Array,
        default() {
            return ['#F7BA2A', '#F7BA2A', '#F7BA2A']
        }
    },
    iconClasses: {
        type: Array,
        default() {
            return ['icon-sad', 'icon-normal', 'icon-face']
        }
    },
    voidColor: {
        type: String,
        default: '#C6D1DE'
    },
    disabledVoidColor: {
        type: String,
        default: '#EFF2F7'
    },
    showText: Boolean,
    showScore: Boolean,
    texts: Array,
    clearable: Boolean,
    allowHalf: Boolean,
} as Record<string, any>;

export type ScorePropsType = ExtractPropTypes<typeof scoreProps>;

export const propsResolver = createPropsResolver<ScorePropsType>(
    scoreProps, scoreSchema, schemaMapper);
